<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

	<%@ page import="java.sql.ResultSet" %>
	<%@ page import="java.sql.SQLException" %>
	<%@ page import="java.sql.Statement" %>
	<%@ page import="java.sql.Connection" %>
	<%@ page import="java.sql.DriverManager" %>
	<%@ page language="java" import="java.lang.*" %>
	<%@ page import = "java.sql.SQLException" %>
	<%@ page import = "com.seniorproject.aims.*" %>
	<%@ page import = "java.util.List" %>
	<%@page import="java.util.ArrayList"%>
	<%@ page import = "java.util.Properties" %>
	<%@ page import = "javax.servlet.ServletContext" %>
	<%@ page import = "java.io.File" %>
	<%@ page import = "java.io.InputStream" %>
	<%@ page import = "java.sql.PreparedStatement" %>
	<%@page import="java.util.regex.Matcher"%>
	<%@page import="java.util.regex.Pattern"%>
	
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Add Schedule</title>
<link rel="stylesheet" type="text/css" href="css/stylev2.css" />
	<link rel="stylesheet" href="css/validation.css" />
	<link rel="stylesheet" href="css/jquery.mobile-1.3.2.min.css"/>
	<link rel="stylesheet" type="text/css" href="css/table-no-header.css" />
	<script type="text/javascript" src="js/livevalidation_standalone.js"></script> 
	<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
	<link rel="stylesheet" type="text/css" href="css/student-system.css" />	

	
	<style type="text/css">
		a {
	      text-decoration:none;
	   }
	</style>
</head>
<body>
<%
//Get session
	String strUser = String.valueOf(session.getAttribute("sUser"));
	HttpSession htp_session = request.getSession();
			
	if (htp_session == null || htp_session.getAttribute("sUser") == null) {
	    // Forward the control to login.jsp if authentication fails or session expires
	    request.getRequestDispatcher("/login.jsp").forward(request,
	        response);
	}
	
	if("admin".equals(htp_session.getAttribute("sUser"))){%>
	<script>alert("This user dont have PERMISSION to access this zone.");</script>
	<meta HTTP-EQUIV="Refresh" CONTENT="0; URL=admin_home.jsp"> 	
	<%}
	
	//GET PERMISSION

		String name = String.valueOf(session.getAttribute("name"));
		String surname = String.valueOf(session.getAttribute("surname"));
		String role_name = String.valueOf(session.getAttribute("curriculum_role"));
		
		String department_id = String.valueOf(session.getAttribute("department_id"));
				
		System.out.println("name : " + name);///////////////////////////////
		System.out.println("department_id : " + department_id);/////////////////////////
		
		List<String> system_name = new ArrayList<String>();
		
		Permission permission = new Permission(strUser,name);
		permission.setDepartmentId(department_id);
		permission.setCurriculumCreate(Boolean.valueOf(String.valueOf(session.getAttribute("curriculum_create"))));
		permission.setCurriculumDelete(Boolean.valueOf(String.valueOf(session.getAttribute("curriculum_delete"))));
		permission.setCurriculumRead(Boolean.valueOf(String.valueOf(session.getAttribute("curriculum_read"))));
		permission.setCurriculumUpdate(Boolean.valueOf(String.valueOf(session.getAttribute("curriculum_update"))));
		
		String permiss = "";
		if(permission.getCurriculumCreate()) {
			permiss = permiss + "Add";
		}
		if(permission.getCurriculumUpdate()) {
			if("".equals(permiss)) {
				permiss = permiss + "Edit";
			} else {
				permiss = permiss + " Edit";
			}
		}
		if(permission.getCurriculumRead()) {
			if("".equals(permiss)) {
				permiss = permiss + "Read";
			} else {
				permiss = permiss + " Read";
			}
		}
		if(permission.getCurriculumDelete()) {
			if("".equals(permiss)) {
				permiss = permiss + "Delete";
			} else {
				permiss = permiss + " Delete";
			}
		}
		
	///////////////////////////////////////////////////////////////////////////////////////////////////////////			
	//check permission
		if(!permission.getCurriculumCreate()){%>
			<script>alert("This user dont have PERMISSION to access this zone.");</script>
			<meta HTTP-EQUIV="Refresh" CONTENT="0; URL=curriculum_home.jsp"> 	
		<%}
	
		//set Database Connection
				String hostProps = "";
				String usernameProps  = "";
				String passwordProps  = "";
				String databaseProps = "";

				try {
					//get current path
					ServletContext servletContext = request.getSession().getServletContext();
					
					InputStream input = servletContext.getResourceAsStream("/properties/connectDB.properties");
					Properties props = new Properties();
					
					props.load(input);

					hostProps  = props.getProperty("host");
					usernameProps  = props.getProperty("username");
					passwordProps  = props.getProperty("password");
					databaseProps = props.getProperty("database");
				} catch (Exception e) { 
					out.println(e);  
				}

				System.out.println("hostProperties : "+hostProps);////////////////try/////////////////
				System.out.println("usernameProperties : "+usernameProps);////////////////try/////////////////
				System.out.println("passwordProperties : "+passwordProps);////////////////try/////////////////
				System.out.println("databaseProperties : "+databaseProps);////////////////try/////////////////

				// connect database
						Connection connect = null;		
						try {
							Class.forName("com.mysql.jdbc.Driver");
						
							connect =  DriverManager.getConnection("jdbc:mysql://" + hostProps  + "/" + databaseProps +
									"?user=" + usernameProps  + "&password=" + passwordProps + "&characterEncoding=tis620");//////"&characterEncoding=tis620" Encoding Thai);
						
							if(connect != null){
								System.out.println("Database Connect Sucesses.");
							} else {
								System.out.println("Database Connect Failed.");	
							}
						
						} catch (Exception e) {
							out.println(e.getMessage());
							e.printStackTrace();
						}
						System.out.println("////////////// START SCHEDULE ///////////////////");//////////////////////////////////////////////////////*/		
						
				// GET information from Curriculum
						String CurriculumId = request.getParameter("CurriculumId");
						String CurriculumNameENOLD = request.getParameter("nameCurriculumEN");
						int DepartmentIdOLD = Integer.parseInt((request.getParameter("departmentId")));
						String departmentOld = new String(request.getParameter("departmentName").getBytes("ISO8859_1"),"UTF-8");
						String YearOLD = request.getParameter("year");
						int Credit = Integer.parseInt(request.getParameter("credit"));
						
						int TotalCredit = 0;
						int CurrentCredit =0;
						List<Semester> semester2 = new ArrayList<Semester>();
						
						String YearSemester2 = request.getParameter("YearSemester");
	  					String TermSemester2 = request.getParameter("TermSemester");
	  					String CreditSemester2 = request.getParameter("CreditSemester");		
	  			
	  					String tempID = request.getParameter("sysID");	
	  					// IF DELETE
	  					
	  			if(request.getParameter("delete").equals("delete")){
	  				try {			   
						connect.createStatement().executeUpdate("DELETE FROM `course_semester` "
						+" WHERE semester_program_id = '"+ tempID + "'");
						
						String sql_course_semester = "DELETE FROM `course_semester` "
								+" WHERE semester_program_id = '"+ tempID + "'";
						
						/* Log file */
						String log_user = strUser+" delete course_semester";
						Log.writeUserFile(log_user);
						Log.writeUserFile(sql_course_semester);
						
						System.out.println("delete sucess");////////////try//////////
					} catch (SQLException e) {
						e.printStackTrace();
					}
	  			}
				// FIND DUPLICATE FROM DATA BASE
						try{
							ResultSet rs = connect.createStatement().executeQuery("SELECT `curriculum_id`,`semester`,`year`,`credit`"            
									+ " FROM semester_program "
									+ " WHERE curriculum_id = "+CurriculumId+" AND semester="+TermSemester2+" AND year="+YearSemester2+"");
																			
							while(rs.next()) {
								Semester semes2 = new Semester();
								
								semes2.setCurriculumId(rs.getInt("curriculum_id"));
								semes2.setSemester(rs.getInt("semester"));
								semes2.setYear(rs.getInt("year"));										
								semes2.setCredit(rs.getInt("credit"));		
								
								semester2.add(semes2);	
								System.out.println("semester2.size(): "+semester2.size());
							}
						}catch (SQLException e) {
							e.printStackTrace();
						}		
				
///////////////////////////////////////////////////////////////////////////////////////////////						
						/*Find Semester and Semester Program in DB for TotalCredit*/
						List<Semester> semesterC = new ArrayList<Semester>();						

						try{
							ResultSet rs_semesterC = connect.createStatement().executeQuery("SELECT `semester_program_id`,`curriculum_id`,`semester`,`year`,`credit`"            
									+ " FROM semester_program "
									+ " WHERE curriculum_id = "+ CurriculumId+""
									+ " ORDER BY year");
							
							while(rs_semesterC.next()) {
								Semester semesC = new Semester();
								
								semesC.setCurriculumId(rs_semesterC.getInt("curriculum_id"));
								semesC.setSemester(rs_semesterC.getInt("semester"));
								semesC.setYear(rs_semesterC.getInt("year"));										
								semesC.setCredit(rs_semesterC.getInt("credit"));		
								
								semesterC.add(semesC);								
							}
							
						}catch (SQLException e) {
							e.printStackTrace();
						}
						
						for(int tempi= 0;tempi<semesterC.size();tempi++){
							TotalCredit = TotalCredit +semesterC.get(tempi).getCredit();
							System.out.println("Total Current Credit:     "+ TotalCredit);
						}						
///////////////////////////////////////////////////////////////////////////////////////////////		

			if(request.getParameter("checker").equals("ADD")){
			  				request.setCharacterEncoding("UTF-8");
			  				//Temp
			  					String tempYearSemester = request.getParameter("YearSemester");
			  					String tempTermSemester =  new String(request.getParameter("TermSemester").getBytes("ISO8859_1"),"UTF-8");
			  					String tempCreditSemester = request.getParameter("CreditSemester");
			  					
			 //////////////////////////////CHECK IF INPUT WERE SPECIAL CHARACTERS> //////////////////////
			  					Pattern regex = Pattern.compile("[$&-+,:;=?@#^*)(|!%]");
			  					Matcher matchertempYearSemester = regex.matcher(tempYearSemester);
			  					Matcher matchertempTermSemester = regex.matcher(tempTermSemester);
			  					Matcher matchertempCreditSemester = regex.matcher(tempCreditSemester);
			  					
			  		if (matchertempYearSemester.find() || matchertempTermSemester.find() || matchertempCreditSemester.find()){
			  		%>
			  			<script language="javascript"> alert("ข้อมูลไม่ถูกต้อง โปรดใช้ตัวเลขหรือตัวอักษรเท่านั้น");	</script>
			  		<%}else{
			  					boolean checker = tempYearSemester.matches("[-+]?\\d+(\\.\\d+)?");
			  					boolean checker2 = tempTermSemester.matches("[-+]?\\d+(\\.\\d+)?");
			  					boolean checker3 = tempCreditSemester.matches("[-+]?\\d+(\\.\\d+)?");
								System.out.println("checker: "+checker);
			  					//Check if name or credit are zero or not
			  				if(tempYearSemester.equals("") || tempTermSemester.equals("") || tempCreditSemester.equals("")){
			  					if(tempYearSemester.equals("") ){%>
								<script>alert("กรุณาใส่ชั้นปี");</script>
								<%}
			  					else if(tempTermSemester.equals("") ){%>
									<script>alert("กรุณาใส่เทอมของชั้นปี");</script>
								<%}
			  					else if(tempCreditSemester.equals("") ){%>
								<script>alert("กรุณาใส่จำนวนหน่วยกิต");</script>
							<%}
			  				}			  				
			  				if(checker && checker2 && checker3){  								
			  					String YearSemester = request.getParameter("YearSemester");
			  					String TermSemester = request.getParameter("TermSemester");
			  					String CreditSemester = request.getParameter("CreditSemester");	
			  					
				/////////////////////// CHECK IF DUPLICATE /////////////////////												
								
								int	checkerDup = 1;									
			  					if(Integer.parseInt(TermSemester) > 3 ){%>
								<script>alert("กรุณาใส่เทอมของชั้นปีให้ถูกต้อง (1-3)");</script>
							<%}else{							
									for(Semester sem2 : semester2 ) {										
										if(sem2.getSemester()==Integer.parseInt(TermSemester) && sem2.getYear()==Integer.parseInt(YearSemester) && sem2.getCurriculumId()== Integer.parseInt(CurriculumId)){
												checkerDup = 0;										
										}
									}								
								System.out.println("/////checkerDup:  "+checkerDup);								
								if(checkerDup == 1){
									//TEMP CREDIT
									
									int tempCredit = TotalCredit;// current total 135
									int tempMaxCredit = Credit;//max 140
									int tempCreditSemester2 = Integer.parseInt(CreditSemester2); // 5
									int tempCheck = tempCredit+tempCreditSemester2;//140
									TotalCredit = tempCheck;
									if(tempMaxCredit < tempCheck){
										TotalCredit = tempCredit;
										%><script>alert("หน่วยกิตรวมของแผนรายวิชาเกินหน่วยกิตของหลักสูตรค่ะ")</script><%
									}else{
										
			  							try {	
					  					 			  PreparedStatement pstmt = connect.prepareStatement("INSERT INTO `semester_program`(`curriculum_id`,`semester`,`year`,`credit`)" 
					  											+ " VALUES ('"+ CurriculumId +"','"+ TermSemester +"','"+ YearSemester +"','"+ CreditSemester +"')" , Statement.RETURN_GENERATED_KEYS);
					  					 			  
					  								 	pstmt.executeUpdate();   	
					  								 	
					  								 	String sql_semester_program = "INSERT INTO `semester_program`(`curriculum_id`,`semester`,`year`,`credit`)" 
					  											+ " VALUES ('"+ CurriculumId +"','"+ TermSemester +"','"+ YearSemester +"','"+ CreditSemester +"')";
														
														/* Log file */
														String log_user = strUser+" add semester_program";
														Log.writeUserFile(log_user);
														Log.writeUserFile(sql_semester_program);
				%>
					  								<script language="javascript"> alert("บันทึกแผนการศึกษาสำเร็จ");</script>
				<%
					  								} catch (SQLException e) {
					  									System.out.println("Error At Phase 1 Add CurriID:"+e);
					  									e.printStackTrace();
					  								}
									}
								}else{
									%><script>alert("มีแผนรายวิชานี้อยู่แล้วค่ะ")</script><%
								}
							}
								
			  							
			  				}else{//checker%>
								<script language="javascript"> alert("กรุณาใส่ชั้นปี/เทอม/หน่วยกิต ด้วยตัวเลขค่ะ");</script>
							<%}
			  				
			  		}
			    }
//////////////////////////////////////////////////////////////////////////////////////////
				
						/*Find Course in DB*/
						List<Course> course3 = new ArrayList<Course>();						

						try{
							ResultSet rs_cour3 = connect.createStatement().executeQuery("SELECT `course_id`,`course_name_en`,`credit`"            
									+ " FROM course"
									+ " WHERE curriculum_id = "+ CurriculumId+""
									+ " ORDER BY `course_id`");
							
							while(rs_cour3.next()) {
								Course cour3 = new Course();
								
								cour3.setCourseId(rs_cour3.getString("course_id"));
								cour3.setCourseNameEN(rs_cour3.getString("course_name_en"));
								cour3.setCredit(rs_cour3.getInt("credit"));										
								
								course3.add(cour3);								
							}
							
						}catch (SQLException e) {
							e.printStackTrace();
						}				
						
						/*Find Semester and Semester Program in DB*/
						List<Semester> semester = new ArrayList<Semester>();						

						try{
							ResultSet rs_semester = connect.createStatement().executeQuery("SELECT `curriculum_id`,`semester`,`year`,`credit`"            
									+ " FROM semester_program "
									+ " WHERE curriculum_id = "+ CurriculumId+""
									+ " ORDER BY year");
							
							while(rs_semester.next()) {
								Semester semes = new Semester();
								
								semes.setCurriculumId(rs_semester.getInt("curriculum_id"));
								semes.setSemester(rs_semester.getInt("semester"));
								semes.setYear(rs_semester.getInt("year"));										
								semes.setCredit(rs_semester.getInt("credit"));
								
								semester.add(semes);								
							}
							
						}catch (SQLException e) {
							e.printStackTrace();
						}
						
						connect.close();
						
			 %>
	<div id="page-wrap">
		<div id="inside">
			<table border="0">
				<tr style="font-size:24px">
					<td width="600" height="100" style= "background-color: #273b80;border: 0px ;padding: 0px; 0px;" >
						<div id="header_banner-2"></div>
					</td>
					<td width="680" height="100" style= "background-color: #273b80;border: 0px;padding: 0px; 0px;" >
						<p align="right" ><label><font size="4" color="#FFFFFF">  username : <%=strUser %>&nbsp;&nbsp;</font></label></p>
						<a href="logout.jsp"><p align="right"><label style="cursor: pointer;"><font size="3" color="#ffffff">log out &nbsp;</font></label></p></a>
					</td>							
				</tr>
			</table>
			
				<div id="main-content-ac">	
					&nbsp;
					<label><font size="5">เพิ่มแผนการศึกษา</font></label>
					<br><br><br>
					<font size="4">หลักสูตร: </font><font size="3.5"><%=CurriculumNameENOLD %> </font><br>
					<font size="4">ภาควิชา: </font><font size="3.5"><%=departmentOld %> </font><br>
					<font size="4">จำนวนหน่วยกิตสูงสุด: </font><font size="3.5"><%=Credit %> หน่วย (ปัจจุบัน: <%=TotalCredit %>)</font><br>
					<font size="4">ปีพ.ศ.: </font><font size="3.5"><%=YearOLD%></font><br>
				</div>

		<%
			////////////////// Add New Semester_program ///////////////////
		%>		
			<div id="main-content-ac" align="center">
					<table border="0">	
					<form id="form" name="form" method="post" action="curriculum_add_schedule.jsp">
						<input type="hidden" id="CurriculumId" name="CurriculumId" value="<%=CurriculumId%>" />
						<input type="hidden" id="nameCurriculumEN" name="nameCurriculumEN" value="<%=CurriculumNameENOLD%>" />
						<input type="hidden" id="departmentId" name="departmentId" value="<%=DepartmentIdOLD%>" />
						<input type="hidden" id="departmentName" name="departmentName" value="<%=departmentOld%>" />
						<input type="hidden" id="year" name="year" value="<%=YearOLD%>" />						
						<input type="hidden" id="credit" name="credit" value="<%=Credit%>" />	
						
						<input type="hidden" id="checker" name="checker" value="ADD" />	
						<input type="hidden" id="delete" name="delete" value="none" />	
						
						<tr style="font-size:24px">
							<td  height="50">
								<font size="4"><strong>ชั้นปี</strong></font>
							</td>
							<td  height="50">
								<input autocomplete="off" placeholder="ex. 1" name="YearSemester" type="text" required style="font-size:18px" maxlength="1" />
							  <label><font size="4" color="#FF0000">*</font></label>
							</td>
							
							<td  height="50">
								<font size="4"><strong>เทอม</strong></font>
							</td>
							<td  height="50">
								<input autocomplete="off" placeholder="1,2 or 3" name="TermSemester" type="text" required style="font-size:18px" maxlength="1" />
							  <label><font size="4" color="#FF0000">*</font></label>
							</td>
							
						</tr>
							
						<tr style="font-size:24px">
							<td height="50">
								<font size="4"><strong>จำนวนหน่วยกิต</strong></font>
							</td>
							<td height="50">
								<input autocomplete="off" placeholder="ex. 30" name="CreditSemester" type="text" required style="font-size:18px" maxlength="3" />
								<label><font size="4" color="#FF0000">*</font></label>								
							</td>
													
						</tr>
						<tr style="font-size:24px">						
							<td>
								<center><input type="submit" value="ADD" name="ADD" class="buttonStyle"/></center>
							</td>	
						
					</form>	
					
					<form id="form" name="form" method="post" action="curriculum_semester_detail.jsp">
						<input type="hidden" id="CurriculumId" name="CurriculumId" value="<%=CurriculumId%>" />
						<input type="hidden" id="nameCurriculumEN" name="nameCurriculumEN" value="<%=CurriculumNameENOLD%>" />
						<input type="hidden" id="departmentId" name="departmentId" value="<%=DepartmentIdOLD%>" />
						<input type="hidden" id="departmentName" name="departmentName" value="<%=departmentOld%>" />
						<input type="hidden" id="year" name="year" value="<%=YearOLD%>" />						
						<input type="hidden" id="credit" name="credit" value="<%=Credit%>" />	
						
						<input type="hidden" id="checker" name="checker" value="ADD" />
						<input type="hidden" id="delete" name="delete" value="none" />		
					
						<td><center><input type="submit" value=" สรุปผลการศึกษา " style="font-size:20px"/></center></td>
					</form>
						</tr>
						
				</table>
				<br><label><font size="3" color="#FF0000" >* กดปุ่ม "สรุปผลการศึกษา" เมื่อต้องการดูข้อมูลแผนการศึกษาทั้งหมด</font></label>
			</div>
				<div id="main-content-ac" >		
							
						<br/>
						<center>
							<div class="CSSTableGenerator">	
							<center>						
								<table border="1" align="center">
									<tr style="font-size:22px">
									   <td>&nbsp;&nbsp;&nbsp;</td>
									    <td><center><strong>ปี /เทอม</strong></center></td>				
									    <td><center><strong>หน่วยกิต</strong></center></td>								
										<td width="15%">เพิ่ม/แก้ไขแผนรายวิชา</td>
										<td width="15%">ลบแผนการศึกษา</td>
									  </tr>
									  
			    <%// TEST EDIT				    
					int semesterCount = 1;
			    	int i =0;		    	
			    	for(Semester sem : semester ) {			    		
				%>
										<tr style="font-size:18px" id="Curriculum<%=semesterCount%>">
										<form id="form<%=semesterCount%>" name="form<%=semesterCount%>" method="post" action="curriculum_add_course_schedule.jsp">
										
										<input type="hidden" id="checker2" name="checker2" value="none" />	
										<input type="hidden" id="delete" name="delete" value="none" />		
										
										<input type="hidden" id="CurriculumId" name="CurriculumId" value="<%=CurriculumId%>" />
										<input type="hidden" id="nameCurriculumEN" name="nameCurriculumEN" value="<%=CurriculumNameENOLD%>" />
										<input type="hidden" id="departmentId" name="departmentId" value="<%=DepartmentIdOLD%>" />
										<input type="hidden" id="departmentName" name="departmentName" value="<%=departmentOld%>" />
										<input type="hidden" id="year" name="year" value="<%=YearOLD%>" />						
										<input type="hidden" id="credit" name="credit" value="<%=Credit%>" />											 
												
												<td id="semesterCount" name="semesterCount" align="center">
													<center><%=semesterCount%></center>
												</td>
												<input type="hidden" id="YearSemester" name="YearSemester" value="<%=sem.getYear()%>" />	
												<input type="hidden" id="TermSemester" name="TermSemester" value="<%=sem.getSemester()%>" />	
												<td id="total<%=semesterCount%>" name="total<%=semesterCount%>" align="center">
													<center>ปี <%=sem.getYear()%> เทอม <%=sem.getSemester()%></center>
												</td>
												<input type="hidden" id="CreditSemester" name="CreditSemester" value="<%=sem.getCredit()%>" />
												<td id="CreditSemester" name="CreditSemester" align="center">
													<center><%=sem.getCredit()%></center>
												</td>
												
												<td><center><input type="submit" value="edit" name="edit" class="buttonStyle"/></center></td>	
										</form>
										
									<form id="form<%=semesterCount%>" name="form<%=semesterCount%>" method="post" action="curriculum_delete_schedule.jsp">	
										<input type="hidden" id="checker2" name="checker2" value="none" />	
										<input type="hidden" id="checker" name="checker2" value="none" />
										<input type="hidden" id="delete" name="delete" value="none" />		
										
										<input type="hidden" id="CurriculumId" name="CurriculumId" value="<%=CurriculumId%>" />
										<input type="hidden" id="nameCurriculumEN" name="nameCurriculumEN" value="<%=CurriculumNameENOLD%>" />
										<input type="hidden" id="departmentId" name="departmentId" value="<%=DepartmentIdOLD%>" />
										<input type="hidden" id="departmentName" name="departmentName" value="<%=departmentOld%>" />
										<input type="hidden" id="year" name="year" value="<%=YearOLD%>" />						
										<input type="hidden" id="credit" name="credit" value="<%=Credit%>" />		
										
										<input type="hidden" id="YearSemester" name="YearSemester" value="<%=sem.getYear()%>" />	
										<input type="hidden" id="TermSemester" name="TermSemester" value="<%=sem.getSemester()%>" />		
										<input type="hidden" id="CreditSemester" name="CreditSemester" value="<%=sem.getCredit()%>" />
																				
												<td><center><input type="image" src="image/delete_icon.png" height="30px" width="30px"/></center></td>
									</form>
										
				<%
						semesterCount++;
						i++;
			    	}
				%>			  	
						</table>
						</center>
						
				</div>
				<br><br><br>
					<p align="center"><a href="curriculum_search.jsp" ><button class="buttonStyle">ย้อนกลับ</button></a></p>	
				<div style="clear: both;"></div>
					<div id="footer"></div>
	</div>	
					<div style="clear: both;"></div>	
    </div>

</body>
</html>